﻿@model ArivisTests.Models.TestResult

@{
    ViewBag.Title = "Edit";

    List<string> knownColors = ViewBag.KnownColors;
    var colorListItems = knownColors.Select(x => new SelectListItem { Value = x, Text = x, Selected = x == Model.Color });
}

@section Navigation{
    @Html.ActionLink("Configuration", "Index", "Config")
    &rsaquo;
    @Html.ActionLink("Results", "Results", "Config")
    &rsaquo;
    @Html.DisplayFor(model => model.Name)
}

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    @Html.HiddenFor(model => model.Id)
    
    <fieldset class="with-border">
        <legend>Edit Results</legend>
        <table class="display-table" style="width:auto">
            <tr>
                <td class="editor-label">
                    @Html.LabelFor(model => model.Name)
                </td>
                <td class="editor-field">
                    @Html.EditorFor(model => model.Name)
                    @Html.ValidationMessageFor(model => model.Name)
                </td>
            </tr>
            <tr>
                <td class="editor-label">
                    @Html.LabelFor(model => model.Color)
                </td>
                <td class="editor-field">
                    @Html.DropDownListFor(model => model.Color, colorListItems, "")
                    @Html.ValidationMessageFor(model => model.Color)
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}
